<template>
  <div>
    <ul>
      <li v-for='(item,index) in arr' :key='index'>
        {{item}}<button @click='noFn(index)'>删除</button>
      </li>
    </ul>
    <button @click='fn'>生成</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [1,5,3]
    }
  },
  methods: {
    fn() {
      this.arr.push(Math.floor(Math.random() * 101))
    },
    noFn(i) {
      this.arr.splice(i, 1)
    }
  }
}
</script>

<style>

</style>